﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PJ.Business.SalePurchase.Sale;
using PJ.Operation.WCF;
using PJ.Business.SalePurchase;

namespace PJ.Operation.SalePurchase.Sale
{
    public class WcfCreateSaleInvoice : WcfCreateInvoice, ICreateSaleInvoice
    {
        #region Interface implementation

        public override ICreateInvoiceResult Execute(string partnerId, string reference, List<string> inventoryItemIds, List<double> quantities, List<string> units)
        {
            SaleInvoiceWCFClient client = ServiceBroker.Instance.SaleInvoiceWCFClient;
            try
            {
                return client.CreateSaleInvoice(partnerId, reference, inventoryItemIds, quantities, units);
            }
            catch (Exception)
            {
                ServiceBroker.Instance.SaleInvoiceWCFClient = null;
                throw;
            }
        }
        #endregion

    }
}
